package com.zh.service.impl;
import java.util.Date;

import com.zh.pojo.domain.DriverSetting;
import com.zh.mapper.DriverSettingMapper;
import com.zh.pojo.properties.DriverSettingProperties;
import com.zh.service.IDriverSettingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 司机配置 服务实现类
 * </p>
 *
 * @author 初四
 * @since 2024-06-13
 */
@Service
public class DriverSettingServiceImpl extends ServiceImpl<DriverSettingMapper, DriverSetting> implements IDriverSettingService {
    @Autowired
    private DriverSettingProperties settingProperties;

    /**
     *  保存司机配置
     * @param id
     */
    @Override
    public void saveDriverSettings(Long id) {
        DriverSetting driverSetting = new DriverSetting();
        driverSetting.setId(id);
        driverSetting.setAutoAccept(true);
        driverSetting.setOrientation(true);
        driverSetting.setListenService(true);
        driverSetting.setOrderDistance(settingProperties.getOrderDistance());
        driverSetting.setRangeDistance(settingProperties.getRangeDistance());
        driverSetting.setCreateTime(new Date());
        super.save(driverSetting);
    }
}
